package palette;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


public class ControleurPalette implements ActionListener {

	private ModelePalette modPalette;

	
	public ControleurPalette(ModelePalette p) {
		this.modPalette = p;
	}
	
	public ModelePalette getModPalette() {return modPalette;}
	public void setModPalette(ModelePalette modPalette) {this.modPalette = modPalette;}

	
	public void actionPerformed(ActionEvent a) {
		
		
		
		
		String source = a.getActionCommand();
		System.out.println("actionCommand = "+ source);
		String[] rvb = source.split("/");
		
		
		int rouge = Integer.parseInt(rvb[0]);
		int vert = Integer.parseInt(rvb[1]);
		int bleu = Integer.parseInt(rvb[2]);
		
		Color c = new Color(rouge,vert,bleu);

		modPalette.setChoixColor(c);
		
		

	}

}
